The most common implementations of Rulebase Resolver Plugins are for:
The Rulebase Resolver Plugin in this example:
The sample code that follows needs the following to run:
To setup this scenario:
There are two tables in the database, one called "RULEBASE" which stores all the available rulebases, with the following columns:
Name | Type | Description |
---|---|---|
ID | VARCHAR(255) (Primary Key) | Corresponds to the rulebase's unique identifier |
CONTENT | BLOB (2M) | The rulebase archive |
Derby Create Table Command:
create table RULEBASE(ID VARCHAR(255) not null primary key, CONTENT BLOB(2M));
The second table called "MODULE" stores the available modules, with the following columns:
Name | Type | Description |
---|---|---|
ID | VARCHAR(255) (Primary Key) | Corresponds to the module's unique name |
CONTENT | BLOB (2M) | The module archive |
Derby Create Table Command:
create table MODULE(NAME VARCHAR(255) not null primary key, CONTENT BLOB(2M));
When an instance of the Oracle Determinations Interview Engine is created, it first loads one of the default RulebaseResolverPlugins. When the plugin resolver discovers a custom RulebaseResolverPlugin (that is, DerbyRulebaseResolver) is available, it uses this to replace the default Rulebase Resolver.
When the initialize method is called, DerbyRulebaseResolver plugin queries the table to retrieve a list of all the rulebases and modules that exist in the database, adds them to a change set and pushes them into the RulebaseService via the applyChangeSet(…) method. The Rulebase Service then loads all the rulebases in the change set ready to be used.
The getInstance method implementation tests that the database is available before returning an initialized instance of the plugin.
To view the source code for the RulebaseResolver sample, refer to examples\interview-engine\rulebase-resolver in the Java runtime zip file.
Load rulebases and rule modules in the Determinations Engine